Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

370
Vistas
Nashhorn engine fails on Java 11 with "unknown call type" error

I have a JS script which is failing when evaluated using Nashorn engine from Java. This code works fine on Java 8 but fails on Java 11. I am getting an error:

unknown call type GET:PROPERTY|ELEMENT|METHOD:NODE_PATH(Object)int@jdk.nashorn.internal.scripts.Script$Recompilation$20$11678$\^eval\_
   java.lang.AssertionError: unknown call type GET:PROPERTY|ELEMENT|METHOD:NODE_PATH(Object)int@jdk.nashorn.internal.scripts.Script$Recompilation$20$11678$\^eval\_
at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.linker.NashornBottomLinker.linkBean(NashornBottomLinker.java:126)
at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.linker.NashornBottomLinker.getGuardedInvocation(NashornBottomLinker.java:78)
     at jdk.dynalink/jdk.dynalink.linker.support.CompositeGuardingDynamicLinker.getGuardedInvocation(CompositeGuardingDynamicLinker.java:109)

The code is:

function __toCall() {
return require('nashorn-invoker')(
    function (require) {
        var Text = function Text() {
            StringLeaf.call(this);
        };
        extend(Text, StringLeaf);
        Text.prototype.ontologyType = function () {
            return 'cmd.ontology.types.Text';
        };

        var BasicTest = function BasicTest() {
            var _field = new Text();
            _field._fieldName = 'field';
            _field._name = 'Field';
            _field._defaultValue = '';

            var curNode = this;
            Structure.call(this, {
                field: _field
            });
        };
        extend(BasicTest, Structure);
        BasicTest.prototype.ontologyType = function () {
            return 'cmd.ontology.test.BasicTest';
        };
        BasicTest.prototype._name = 'Basic Test';
        return (function () {
            var model = [];
            var callbackFn = function (result) {
                if (result !== true) model.push.apply(model, result);
            };
            test.child('field').validate(vc, callbackFn);
            var result = model.length === 0 ? true : model;
            print('Callback function result: ' + JSON.stringify(result));
            return result;
        })();
    }
);

}

File nashorn-invoker.js

 module.exports = function nashornInvoker(callback) {
      return callback(require); // runs the given callback and provide our "require" context
   };
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Similar problem was answered here.

JS script doesn't run with Java 11 but works with Java 8

This sounds like it could be the JDK-8261926 bug. The good news is that this is fixed, but only in the standalone Nashorn, not the one integrated into Java 11. There's also a page describing how you can ensure that standalone Nashorn is used by your program instead of the integrated one on Java 11.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda